<template>
	<view>
		<view class="qi-box" v-if="isShow">
			<img class='qi-img' src='http://127.0.0.1:7001/public/whj/qidong.png' />
		</view>
		<view class="qi-box1" v-if="isShow1">
			<u-swiper @click='tiaozhuan()' class='u-box' height='100vh' :list="list5" @change="e => current = e.current"
				:autoplay="false">
				<view slot="indicator" class="indicator">
					<view class="indicator__dot" v-for="(item, index) in list5" :key="index"
						:class="[index === current && 'indicator__dot--active']">
					</view>
				</view>
			</u-swiper>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isShow: true,
				isShow1: false,
				list5: [
					'http://127.0.0.1:7001/public/whj/11.png',
					'http://127.0.0.1:7001/public/whj/22.png',
					'http://127.0.0.1:7001/public/whj/33.png',
				],
				current: 0
			}
		},
		methods: {
			setTimer() {
				if (this.timer == null) {
					this.timer = setTimeout(() => {
						this.isShow = false
						this.isShow1 = true
					}, 3000)
				}
			},
			tiaozhuan() {
				if (this.current == 2) {
					// console.log(this.current)
					let token = uni.getStorageSync('token')
					// if (token != undefined || token != null) {
					// 	uni.switchTab({
					// 		url: '/pages/Home/Home'
					// 	})
					// }
					if (token) {
						uni.switchTab({
							url: '/pages/Home/Home'
						})
					} else {
						uni.redirectTo({
							url: '/pages/login/login'
						})
					}
				}
			}
		},
		onLoad() {
			this.setTimer()
		}
	}
</script>

<style lang="scss">
	.qi-box {
		width: 100%;
		height: 100upx;

		.qi-img {
			width: 100%;
			margin-top: 12%;
		}
	}

	.qi-box1 {
		width: 100%;
		height: 1200upx;

	}


	.indicator {
		@include flex(row);
		justify-content: center;

		&__dot {
			height: 6px;
			width: 6px;
			border-radius: 100px;
			background-color: rgba(255, 255, 255, 0.35);
			margin: 0 5px;
			transition: background-color 0.3s;

			&--active {
				background-color: #ffffff;
			}
		}
	}

	.u-box {
		width: 100%;
		height: 100vh;
		margin-left: 10;
	}
</style>
